#include "./socket_lib/ServerSocket.h"
#include "./socket_lib/SocketException.h"
#include <iostream>
#include <string>

int main (void)
{
	std::cout << "running....\n";

	try
	{
		/* Create the socket */
		ServerSocket server ( 2000 );

		while ( true )
		{

			ServerSocket new_sock;
			server.accept ( new_sock );

			try
			{
				while ( true )
				{
					std::string data;
					new_sock >> data;
					new_sock << data;
				}
			}
			catch ( SocketException& ) {}

		}
	}
	catch ( SocketException& e )
	{
		std::cout << "Exception was caught:" << e.description() << "\nExiting.\n";
	}

	return 0;
}

